import com.troyworks.util.DesignByContract;
/**
 * @author Troy Gardner
 */
class com.troyworks.util.TestDesignByContract {
	
	public var REQUIRE:Function;
	public var ASSERT:Function;
	public function TestDesignByContract() {
		DesignByContract.initialize(this);
	}
	public static function main(container_mc : MovieClip) : Void {
		trace("main---------------------------------");
		DesignByContract.HALT_ON_ERRORS = false;
		var thf : TestDesignByContract = new TestDesignByContract();
		thf.runTests();
	}
	public function runTests() : Void{
		trace("running Tests\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\");
	//	REQUIRE(testEmptyConstructor(), "hsm requires a name to work, (necessary for debugging practically, when tons are floating around)");
	//	REQUIRE(testNullStateConstructor(), "hsm requires a non null name to work, (necessary for debugging practically, when tons are floating around)");
		testConstructor();

		testAssertNotification();

		testRequireNotification();
		testREQUIRE();
		testASSERT();
			trace("HIGHLIGHT0, running test");
		
		testMyREQUIRE();
		testMyASSERT();
		trace("finished running Tests/////////////////////////////////////");
	}
	public function testConstructor() : Boolean{
		var res : Boolean = false;
		var dbc : DesignByContract = new DesignByContract();
		return res;
	}
	public function testAssertNotification() : Boolean{
		var res : Boolean = false;
		var dbc : DesignByContract = new DesignByContract();
		dbc.dispatchEvent (
		{
			type :DesignByContract.EVTD_ASSERT_FAILED, msg:"TEST ASSERT FAILED", fatal:true
		});
		return res;
		
	}
	public function testRequireNotification() : Boolean{
		var res : Boolean = false;
		var dbc : DesignByContract = new DesignByContract();
		dbc.dispatchEvent (
		{
			type :DesignByContract.EVTD_REQUIRE_FAILED, msg:"TEST REQUIRE FAILED", fatal:true
		});
		return res;
		
	}
	public function testREQUIRE() : Boolean{
		var res : Boolean = false;
		DesignByContract.REQUIRE(false, "test of REQUIRE");
		return res;
		
	}
	public function testASSERT() : Boolean{
		var res : Boolean = false;
		DesignByContract.ASSERT(false, "test of ASSERT");
		return res;
		
	}
	public function testMyREQUIRE() : Boolean{
		var res : Boolean = false;
		REQUIRE(false, "test of My REQUIRE");
		return res;
		
	}
	public function testMyASSERT() : Boolean{
		var res : Boolean = false;
		ASSERT(false, "test of My ASSERT");
		return res;
		
	}
	
}